home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / OldSrc / CH3 / SRC / OBJPRINT.FRM < prev    next >
Text File  |  1996-01-31  |  2KB  |  77 lines

  1. VERSION 4.00
  2. Begin VB.Form ObjPrintForm 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "ObjPrint"
  5.    ClientHeight    =   3090
  6.    ClientLeft      =   2640
  7.    ClientTop       =   1635
  8.    ClientWidth     =   3090
  9.    Height          =   3780
  10.    Left            =   2580
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   3090
  15.    ScaleWidth      =   3090
  16.    Top             =   1005
  17.    Width           =   3210
  18.    Begin VB.Menu mnuFile 
  19.       Caption         =   "&File"
  20.       Begin VB.Menu mnuFilePrint 
  21.          Caption         =   "&Print"
  22.       End
  23.       Begin VB.Menu mnuFileSep 
  24.          Caption         =   "-"
  25.       End
  26.       Begin VB.Menu mnuFileExit 
  27.          Caption         =   "E&xit"
  28.       End
  29.    End
  30. End
  31. Attribute VB_Name = "ObjPrintForm"
  32. Attribute VB_Creatable = False
  33. Attribute VB_Exposed = False
  34. Option Explicit
  35.  
  36. ' ************************************************
  37. ' Draw a diamond on the form or printer.
  38. ' ************************************************
  39. Sub DrawPicture(obj As Object)
  40.     obj.CurrentX = 1540
  41.     obj.CurrentY = 100
  42.     obj.Line -Step(1440, 1440)
  43.     obj.Line -Step(-1440, 1440)
  44.     obj.Line -Step(-1440, -1440)
  45.     obj.Line -Step(1440, -1440)
  46. End Sub
  47.  
  48. ' ************************************************
  49. ' Draw the picture on the form.
  50. ' ************************************************
  51. Private Sub Form_Paint()
  52.     Cls
  53.     DrawPicture Me
  54. End Sub
  55.  
  56.  
  57. Private Sub mnuFileExit_Click()
  58.     Unload Me
  59. End Sub
  60.  
  61.  
  62. ' ***********************************************
  63. ' Draw the picture on the Printer object.
  64. ' ***********************************************
  65. Private Sub mnuFilePrint_Click()
  66.     MousePointer = vbHourglass
  67.     DoEvents
  68.     
  69.     DrawPicture Printer
  70.     Printer.EndDoc
  71.  
  72.     MousePointer = vbDefault
  73. End Sub
  74.  
  75.  
  76.  
  77.